package com.zzyy.study.config;

import com.zzyy.study.service.ChatAssistant;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.beans.factory.annotation.Value;

/**
 * @auther zzyy
 * @create 2025-02-21 22:42
 */
@Configuration(proxyBeanMethods = false)
public class ChatLanguageModelConfig
{
    /*@Bean
    public ChatLanguageModel chatLanguageModel()
    {
        return
                OpenAiChatModel.builder()
                    .apiKey(System.getenv("LANGCHAIN4J_KEY"))
                    .modelName("qwen-turbo-0624")
                    .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
            .build();
    }*/


    @Bean
    public ChatLanguageModel chatLanguageModel()
    {
        return
                OpenAiChatModel.builder()
                        .apiKey("sk-d8c3724e7a4b4d18932852dae9d90c69")
                        .modelName("deepseek-chat")
                        .baseUrl("https://api.deepseek.com/v1")
                        .build();
    }



    // 你使用第2种类，高阶API    AiService
    @Bean
    public ChatAssistant chatAssistant(ChatLanguageModel chatLanguageModel)
    {
        return AiServices.create(ChatAssistant.class, chatLanguageModel);
    }
}
